package com.business_clean.ui.adapter.custom.permission;

import android.view.View;

import com.business_clean.R;
import com.business_clean.data.mode.permission.PermissionData;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;

import org.jetbrains.annotations.NotNull;

public class PermissionAdapter extends BaseQuickAdapter<PermissionData, BaseViewHolder> {

    private String select = "";

    public PermissionAdapter() {
        super(R.layout.item_permission);
    }

    @Override
    protected void convert(@NotNull BaseViewHolder holder, PermissionData permissionData) {
        holder.setText(R.id.tv_item_permission_title, permissionData.getTitle())
                .setText(R.id.tv_item_permission_content, permissionData.getContent());
        if (select.contains(permissionData.getTitle())) {
            holder.getView(R.id.iv_item_permission_status).setVisibility(View.VISIBLE);
        } else {
            holder.getView(R.id.iv_item_permission_status).setVisibility(View.GONE);
        }
    }


    public void updateSelect(String text) {
        this.select = text;
        notifyDataSetChanged();
    }
}
